﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head >
<title>jtemplate无刷新分页</title>
    <link href="Contents/themes/default/style.css" rel="stylesheet" type="text/css" />
    <link href="Contents/themes/css/core.css" rel="stylesheet" type="text/css" /> 
    <link href="Contents/themes/example.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="Scripts/Darren.Core.js" type="text/javascript"></script>
    <script src="Scripts/jquery.jtemplates.js" type="text/javascript"></script>
    <script src="Scripts/jquery.pagination.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            ShowPage(1,5);
        });
        function render(d)
        {
            if (d.RecordsCount == 0) {
            }
            else {
                $("#JqueryGrid").setTemplateElement("JqueryTemplate", null, { filter_data: true });
                $("#JqueryGrid").processTemplate(d);
                //alert($("#tbBodyContnent").html());
                //页码
                $("#JqueryPager").pager({ onclick:ShowPage,totalCount: d.RecordsCount, pageSize:d.PageSize, pageIndex: d.PageIndex, showMode: "full" });

                //颜色
                $("#JqueryGrid tr:odd").addClass("erow");
                $("#JqueryGrid tr").hoverClass("trhover")
                                       .click(function() {
                                                  $("#JqueryGrid tr").removeClass("trSelected");
                                                   $(this).addClass("trSelected");
                                               });
            }
        }
        function ShowPage(pageIndex, pageSize) {
            var params = { pageIndex: pageIndex, pageSize: pageSize, timer: new Date().getTime() };
            Sw.ActionResult("/ajaxHandler/Department/List.aspx?oper=List", params, render);
        }
    </script>
</head>
<body>  
<textarea id="JqueryTemplate" style="display:none">
<table  id="JqueryDataTable">
<thead>	
<tr>
    <th style="width: 10%;" scope="col">部门编号</th>
    <th style="width: 45%" scope="col">部门名称</th>
    <th style="width: 10%;" scope="col">父编号</th>		
    <th style="width: 20%;" scope="col">创建时间</th>
    <th style="width: 15%;" scope="col">状态</th>
</tr>
</thead>
<tbody>
 {#foreach $T.ResultTable as record}
<tr>
<td>{$T.record.Id}</td>
<td>{$T.record.Name}</td>
<td>{$T.record.ParentId}</td>	
<td>{Sw.FormatJsonDate($T.record.CreateTime)}</td>
<td>{$T.record.IsDelete}</td>	
</tr>
{#/for}	
</tbody>
</table>
</textarea>
  <div class="main-header">
         <div class="main-title">jtemplate无刷新分页</div>
        </div>	
<div id="JqueryGrid" class="JqueryGrid"></div>
<div id="JqueryPager"></div>
</body>
</html>
